<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>

    /**
     var makeSound = function(animal){
       console.log(animal instanceof String);
       if(animal instanceof Duck){
         console.log("ggggggggggggggg");
       }else if(animal instanceof Dog){
         console.log("wwwwwwwwwwwwwwwwwwww");
       }
     }
 
     var Duck = function(){}
     var Dog = function(){}
 
     makeSound(new Duck())
     makeSound(new Dog())
    */

    /** 对象的多态性
     function makeSound(animal){
       animal.sound()
     }
 
     var Duck = function(){}
     Duck.prototype.sound = function(){
       console.log("ggggggggggggggggggg");
     }
 
     var Dog = function(){}
     Dog.prototype.sound = function(){
       console.log("WWWWWWWWWWWWWWWWWWW");
     }
 
     makeSound(new Duck())
     makeSound(new Dog())
     */


     /**
     var googleMap = {
       show: function (){
         console.log("start render google map....");
       }
     }
     var baiduMap = {
       show: function (){
         console.log("start render baidu map....");
       }
     }

     function renderMap(map){
       if(map.show instanceof Function){
         map.show()
       }
     }

     renderMap(googleMap)
     */


  </script>
</body>
</html>